package com.s63.ssm.singleton;

import java.io.IOException;
import java.util.Properties;

public class ConfigManager {
    private static ConfigManager instance = new ConfigManager();

    private Properties props = new Properties();

    private ConfigManager() {
        // 读取并解析配置文件
        try {
            props.load(getClass().getResourceAsStream("/db.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        System.out.println("ConfigManager实例被创建");
    }

    public static ConfigManager getInstance() {
        return instance;
    }

    public String getValue(String key) {
        return props.getProperty(key);
    }
}
